package com.hsb.seckill.controller;

import com.hsb.seckill.entity.User;
import com.hsb.seckill.result.ResBean;
import com.hsb.seckill.result.ResBeanEnum;
import com.hsb.seckill.service.OrderService;
import com.hsb.seckill.vo.OrderDetailVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * (Order)表控制层
 *
 * @author makejava
 * @since 2021-09-05 21:58:26
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    /**
     * 服务对象
     */
    @Resource
    private OrderService orderService;


    /**
     * 订单详情
     * @return
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResBean detail(User user,Long orderId){
        if (user == null){
            return ResBean.error(ResBeanEnum.USER_NOT_LOGIN);
        }
        OrderDetailVo detail = orderService.detail(orderId);
        return ResBean.success(detail);
    }
}